package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.gdms.service.AdminTeacherService;
import com.zr.gdms.serviceimpl.AdminTeacherServiceImpl;
/**
 * 修改教师
 * @author 李培宁
 *
 */
public class UpdateTeacherControllerLPN extends HttpServlet{

	AdminTeacherService ats = new AdminTeacherServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		String tname = req.getParameter("tname");
		String tage = req.getParameter("tage");
		String tdepart = req.getParameter("tdepart");
		String tprofe = req.getParameter("tprofe");
		String tsex = req.getParameter("tsex");
		String ttel = req.getParameter("ttel");
		int tid = Integer.parseInt(req.getParameter("tid"));
		System.out.println(tsex);
		boolean flag = ats.updateTeacher(tname, tage, tdepart, tprofe, tsex, ttel, tid);
		PrintWriter pw = resp.getWriter();
		if (flag) {
			pw.write("1");
		} else {
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
}
